﻿using System.Collections.Generic;
using System.Runtime.Serialization;

namespace Sharp.Platform.Mvc.Models
{
    [DataContract]
    public class zTreeNode
    {
        [DataMember(Name = "id")]
        public string Id { get; set; }
        [DataMember(Name = "pId")]
        public string ParentId { get; set; }
        [DataMember(Name = "name")]
        public string Name { get; set; }

        public int OrderIndex { get; set; }
        [DataMember]
        public string link { get; set; }

        public string _target;
        [DataMember(Name = "target")]
        public string Target
        {
            get
            {
                if (_target == null)
                {
                    return string.Empty;
                }
                else
                {
                    return _target;
                }
            }
            set
            {
                _target = value;
            }
        }
        [DataMember(Name = "isParent")]
        public bool IsParent { get; set; }
        [DataMember(Name = "open")]
        public bool Open { get; set; }

        public zTreeNode()
        {
            Children = new List<zTreeNode>();
        }

        [DataMember(Name = "children")]
        public IList<zTreeNode> Children { get; set; }
        [DataMember(Name = "checked")]
        public bool? Checked { get; set; }
        /// <summary>
        /// 原始数据
        /// </summary>
        [DataMember(Name = "raw")]
        public object Raw { get; set; }
    }
}